package com.techfort.affs;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TabHost;

public class AffsTabs extends TabActivity  {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		Log.i("INFO","tabs called");
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tabs);
		
		TabHost tabs = getTabHost();
		TabHost.TabSpec view = tabs.newTabSpec("view").setIndicator("View").setContent(new Intent().setClass(this, AffsList.class));
		TabHost.TabSpec share = tabs.newTabSpec("share").setIndicator("Share").setContent(new Intent().setClass(this, ShareAffs.class));
		
		tabs.addTab(view);
		tabs.addTab(share);
		tabs.setCurrentTab(1);
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater mi = getMenuInflater();
		mi.inflate(R.menu.mainmenu, menu);
		return true;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		
		switch(item.getItemId()){
		case R.id.share:
			startActivity(new Intent(AffsTabs.this, ShareAffs.class));
			break;
		case R.id.logout:
			break;
		default:
				return true;
		
		}
		return true;
	}
}
